package com.ruoyi.manager.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.ruoyi.manager.mapper.StrategyMapper;
import com.ruoyi.manager.domain.Strategy;
import com.ruoyi.manager.service.IStrategyService;

/**
 * strategyService业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-13
 */
@Service
public class StrategyServiceImpl implements IStrategyService 
{
    @Autowired
    private StrategyMapper strategyMapper;

    /**
     * 查询strategy
     * 
     * @param strategyId strategy主键
     * @return strategy
     */
    @Override
    @Cacheable(cacheNames = "strategyCache" , key = "#strategyId")
    public Strategy selectStrategyById(Long strategyId)
    {
        return strategyMapper.selectStrategyById(strategyId);
    }

    /**
     * 查询strategy列表
     * 
     * @param strategy strategy
     * @return strategy
     */
    @Override
    public List<Strategy> selectStrategyList(Strategy strategy)
    {
        return strategyMapper.selectStrategyList(strategy);
    }

    /**
     * 新增strategy
     * 
     * @param strategy strategy
     * @return 结果
     */
    @Override
    public int insertStrategy(Strategy strategy)
    {
        return strategyMapper.insertStrategy(strategy);
    }

    /**
     * 修改strategy
     * 
     * @param strategy strategy
     * @return 结果
     */
    @Override
    @CacheEvict(cacheNames = "strategyCache" , key = "#strategy.id")
    public int updateStrategy(Strategy strategy)
    {
        return strategyMapper.updateStrategy(strategy);
    }

    /**
     * 批量删除strategy
     * 
     * @param ids 需要删除的strategy主键
     * @return 结果
     */
    @Override
    @CacheEvict(cacheNames = "strategyCache" , allEntries = true)
    public int deleteStrategyByIds(Long[] ids)
    {
        return strategyMapper.deleteStrategyByIds(ids);
    }

    /**
     * 删除strategy信息
     * 
     * @param id strategy主键
     * @return 结果
     */
    @Override
    @CacheEvict(cacheNames = "strategyCache" , allEntries = true)
    public int deleteStrategyById(Long id)
    {
        return strategyMapper.deleteStrategyById(id);
    }
}
